#include "history.h"

History_Single::History_Single(int min, int max, int result)
    : min(min), max(max), result(result) {}

QString History_Single::text() {
    return "范围: " + QString::number(min) + "~" + QString::number(max) +
           "   结果: " + QString::number(result);
}


History_Multi::History_Multi(int min, int max, int count, bool isNoRepeat, const QVector<int> &result)
    : min(min), max(max), count(count), isNoRepeat(isNoRepeat), result(result) {}

QString History_Multi::text() {
    return "范围: " + QString::number(min) + "~" + QString::number(max) +
           "   次数: " + QString::number(count) +
           "   " + (isNoRepeat ? "不重复" : "可重复");
}
void History_Multi::show(QWidget *w) {
    GenResult *genResult = new GenResult(result);
    genResult->setAttribute(Qt::WA_DeleteOnClose);
    if(w) AdjustPosition(w, genResult);
    genResult->show();
}
